package demo1;
class B{
    public B(){
        func();
    }
    public void func(){
        System.out.println("B.func()");
    }
}
class D extends B{
   private int num=1;

    @Override
    public void func() {
        System.out.println("D.func()"+num);//父类构造方法还没有走完，所以此时num未被初始化=0.
    }
}
public class Test2 {
    public static void main(String[] args) {
        D d=new D();

    }
}
